package cn.tedu.medicalpath.scheduling.controller;

import cn.tedu.medicalpath.base.response.JsonResult;
import cn.tedu.medicalpath.scheduling.pojo.dto.DoctorsSchedulingQuery;
import cn.tedu.medicalpath.scheduling.pojo.dto.DoctorsSchedulingSaveParam;
import cn.tedu.medicalpath.scheduling.pojo.vo.DoctorSchedulingVO;
import cn.tedu.medicalpath.scheduling.service.DoctorSchedulingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/doctors/scheduling")
@Slf4j
public class DoctorsSchedulingController {

    @Autowired
    private DoctorSchedulingService doctorSchedulingService;

    @GetMapping ("/select")
    public JsonResult select(DoctorsSchedulingQuery doctorsSchedulingQuery) {
        log.debug("开始处理【查询医生排班】的请求，参数：{}", doctorsSchedulingQuery);
        List<DoctorSchedulingVO> list = doctorSchedulingService.select(doctorsSchedulingQuery);
        return JsonResult.success(list);
    }

    @PostMapping("/insert")
    public JsonResult insert(DoctorsSchedulingSaveParam doctorsSchedulingSaveParam) {
        log.debug("开始处理【添加医生排班】的请求，参数：{}", doctorsSchedulingSaveParam);
        doctorSchedulingService.insert(doctorsSchedulingSaveParam);
        return JsonResult.success();
    }

}
